package com.shuwang.business.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;

@Configuration
@EnableSwagger
@Profile({"development", "test"})
public class SwaggerConfig
{
	private SpringSwaggerConfig springSwaggerConfig;

	@Autowired
	public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig)
	{
		this.springSwaggerConfig = springSwaggerConfig;
	}

	@Bean
	public SwaggerSpringMvcPlugin get()
	{
		return new SwaggerSpringMvcPlugin(springSwaggerConfig).apiInfo(
				getApiInfo()).includePatterns("/(?!error).*");
	}

	private ApiInfo getApiInfo()
	{
		return new ApiInfo("客来啦系统用户类在线接口文档", "在线API接口文档", "API 文档提供",
				"314817473@qq.com", "API 许可证", "福建数网网络有限公司");
	}

}
